<%@ page language="java" contentType="text/html; charset=utf8"
	pageEncoding="utf8"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<%@include file="/resources/css/title.jsp"%>
<head>
    <script src="/gsp_banking-0.5/resources/js/numbersOnly.js" type="text/javascript"></script>
    <script type="text/javascript">
        function getTotal() {
            var lastValue = document.getElementById("lastValue");
            var newValue = document.getElementById("newValue");
            var rate = document.getElementById("rate");

            var resultValue = (parseFloat(newValue.value) - parseFloat(lastValue.value)) * parseFloat(rate.value);

            var total = document.getElementById("total");
            total.value = resultValue.toFixed(2);
        }
    </script>
</head>

<body onload="CheckForReload()">

<div class="wrapper">

<%@include file="/resources/css/header.jsp"%>

<%@include file="/resources/css/menu.jsp"%>


<center>
<table class="data_title">

	<tr class="data_title"><td>
		<h3><spring:message code="label.public_service" /></h3>
	</td></tr>

    <tr><td class="data_table">
        <form:form method="post" action="submit_public_service" commandName="publicService">

            <table class="input_form">
                <tr>
                    <td class="input_txt">
                        <i><spring:message code="label.public_service.service_type" /></i>
                    </td>
                    <td  class="input_inp">
                        <span class="input"><form:input path="serviceType" disabled="true"/></span>
                    </td>
                </tr>
                <tr>
                    <td class="input_txt">
                        <i><spring:message code="label.public_service.number" /></i>
                    </td>
                    <td  class="input_inp">
                        <span class="input"><form:input path="serviceId" disabled="true"/></span>
                    </td>
                </tr>
                <tr>
                    <td class="input_txt">
                        <i><spring:message code="label.public_service.prev_value" /></i>
                    </td>
                    <td  class="input_inp">
                        <span class="input"><form:input path="lastValue" disabled="true" id="lastValue"/></span>
                    </td>
                </tr>
                <tr>
                    <td class="input_txt">
                        <i><spring:message code="label.public_service.rate" /></i>
                    </td>
                    <td  class="input_inp">
                        <span class="input"><form:input path="fullRate" disabled="true" id="rate"/></span>
                    </td>
                </tr>
                <tr>
                    <td class="input_txt">
                        <form:label path="newValue"><spring:message code="label.public_service.new_value" /></form:label>
                    </td>
                    <td  class="input_inp">
                        <form:input path="newValue" size="8" maxlength="8" onkeypress="return numbersonly(this, event)" id="newValue"/>
                    </td>
                </tr>
                <tr>
                    <td class="input_txt">
                        <form:label path="newValue"><spring:message code="label.public_service.total" /></form:label></td>
                    </td>
                    <td  class="input_inp">
                        <input type="text" value="" disabled="true" id="total" size="8"/>&nbsp;
                        <form:input path="currency" disabled="true" id="rate" size="4"/>&nbsp;
                        <input type="button" value="Get total" onclick="getTotal()"/>
                    </td>
                </tr>
                <tr>
                    <td class="input_txt">
                        <spring:message code="label.public_service.account" />
                    </td>
                    <td  class="input_inp">
                        <span class="input"><form:select path="accountId" items="${accounts}" itemLabel="fullName" itemValue="id"/></span>
                    </td>
                </tr>

                <tr>
                    <td colspan="2" align="center">
                        <input type="submit" value="<spring:message code="label.public_service.submit"/>" />
                    </td>
                </tr>
            </table>
        </form:form>
    </td></tr>


</table>
</center>


<div class="push"></div>
</div>

<%@include file="/resources/css/footer.jsp"%>
</body>
</html>